<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <!-- <UploadExcel :on-success="handleSuccess" :before-upload="beforeUpload" /> -->
    <!-- <ImageUpload /> -->
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  data() {
    return {
      arr: [
        { id: 1, name: '张三', gender: 1, age: 19 },
        { id: 2, name: '李四', gender: 1, age: 18 },
        { id: 3, name: '王五', gender: 0, age: 20 }
      ],
      value1: ''
    }
  },
  computed: {
    ...mapGetters(['name'])
  },
  methods: {
    beforeUpload(file) {
      const isLt1M = file.size / 1024 / 1024 < 1

      if (isLt1M) {
        return true
      }

      this.$message({
        message: 'Please do not upload files larger than 1m in size.',
        type: 'warning'
      })
      return false
    },
    // results 对应的是excel中数据
    // header对应是excel中的表头
    handleSuccess({ results, header }) {
      console.log(results)
      console.log(header)
    }
  }

}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
